/**
 * Dialog 提示框
 * @param {string} content 提示内容
 * @param {object} option 配置
 */

export default function useModal() {
  const showModal = (content: string, options?: UniApp.ShowModalOptions, title: string = '提示') => {
    return new Promise<UniApp.ShowModalRes>((resolve, reject) => {
      uni.showModal({
        title,
        content,
        showCancel: false,
        confirmColor: '#ffc300',
        success: (res) => resolve(res),
        fail: () => reject(new Error('Alert 调用失败 !')),
        ...options,
      });
    });
  };
  return {
    showModal,
  };
}
